import {Component, Prop, Vue} from 'vue-property-decorator'
import btnResetPrint from './btn_reset_print.tsx'
import {store} from '@/store/index'


@Component({})
export default class btnDelete extends btnResetPrint{
    name:string = 'btn-delete'

    render (h){

        let _vue = this;

         return (

            <poptip trigger="hover" title="确认删除当前单证？" content="">
                <i-button 
                    disabled={_vue.disabled}
                    size='small'
                    onClick={_vue.clickFn}
                    type={_vue.btn.type}>
                    {_vue.btn.title}
                </i-button>
            </poptip>
            
         )
    }
    
    clickFn (){
        this.commitCurrentSingle(this.mod.key);
        if(this.singleNumber){
            store.dispatch('request', {
                url: 'delete/single/id',
                data:{}
            })
        }

    }

    get disabled (){
        return this.singleStatus === '待分配'
    }
    
    

}